#ifndef _GRAPHICS_MAP_CELL_MIRROR_H
#define _GRAPHICS_MAP_CELL_MIRROR_H

#include <Ogre.h>
#include "DwarfFort/InternalStructures.h"

namespace Forests
{
	class GeometryPage;
}


namespace Graphics
{
	class MapCellMirror;
	
	class MapCellMirrorList
	{
		DwarfFort::MapCellList *mOriginals;
		MapCellMirror ****mCells;
		

	public:
		DWORD mMaxX,mMaxY,mMaxZ; // local copies for the event of losing the previous data (or it getting changed)
		MapCellMirrorList(DwarfFort::MapCellList *originals);
		~MapCellMirrorList();
		MapCellMirror *getCell(char x, char y, char z)
		{	
			 if (x < 0 || y < 0 || z < 0 ||
				 x >= mMaxX || y >= mMaxY || z >= mMaxZ)
					return NULL;
			 return mCells[x][y][z];
		}
		void connectNeighbours();
		DwarfFort::MapCellList *getOriginals() {return mOriginals;} 
		
	};
	
	class MapCellMirror  
	{
		MapCellMirror *mXPlus,*mXMinus,*mYPlus,*mYMinus,*mZPlus,*mZMinus;
		MapCellMirrorList *mList;
		DwarfFort::MapCell *mOriginal;

		DWORD mCrc; 
		char  mX,mY,mZ;

		DWORD calcHash();

	public:
		MapCellMirror(DwarfFort::MapCell *cell);
		~MapCellMirror();
	};
}; // namespace Graphics
#endif